/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Oct 15, 2013  1:28:23 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : com.tis.database.services.promis.impl
 * File Name : CustomerCreditNoteServicesImpl.java
 * TODO
 */
package com.tis.database.services.promis.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.criterion.Criterion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tis.database.dao.promis.CustomerCreditNoteDao;
import com.tis.database.entitys.promis.CustomerCreditNote;
import com.tis.database.entitys.promis.CustomerCreditNotePK;
import com.tis.database.entitys.promis.GlPostingDetail;
import com.tis.database.services.promis.ICustomerCreditNoteServices;

/**
 * @author Chatree Siangklom of Administrator
 * Date =Oct 15, 2013 : 1:28:23 PM 
 * CreateBy=Chatree Siangklom
 * 
 * CustomerCreditNoteServicesImpl
 * TODO
 */
@Service
@Transactional(readOnly=true)
public class CustomerCreditNoteServicesImpl implements ICustomerCreditNoteServices {

	private static final Logger logging = LoggerFactory.getLogger(CustomerCreditNoteServicesImpl.class);
	
	@Autowired
	private CustomerCreditNoteDao customerCreditNoteDao;

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#findById(com.tis.database.entitys.promis.CustomerCreditNotePK)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public CustomerCreditNote findById(CustomerCreditNotePK id) throws HibernateException, Exception {
		return customerCreditNoteDao.findById(id);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#saveOrUpdate(com.tis.database.entitys.promis.CustomerCreditNote)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public void saveOrUpdate(CustomerCreditNote e) throws HibernateException, Exception {
		customerCreditNoteDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#saveOrUpdate(java.util.List)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public void saveOrUpdate(List<CustomerCreditNote> e) throws HibernateException, Exception {
		customerCreditNoteDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#findByCriteria(org.hibernate.criterion.Criterion)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<CustomerCreditNote> findByCriteria(Criterion criterion) throws HibernateException, Exception {
		return customerCreditNoteDao.findByCriteria(criterion);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#findByAll(int)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<CustomerCreditNote> findByAll(int MaxResults) throws HibernateException, Exception {
		
		return customerCreditNoteDao.findByAll(MaxResults);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#findHQLByQuery(java.lang.String, java.util.HashMap)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<CustomerCreditNote> findHQLByQuery(String hql, HashMap<String, String> parameter) throws HibernateException, Exception {
		
		return customerCreditNoteDao.findHQLByQuery(hql, parameter);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#SaveOrUpdateHQLByQuery(java.lang.String, java.util.HashMap)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public void SaveOrUpdateHQLByQuery(String hql, HashMap<String, String> parameter) throws HibernateException, Exception {
		customerCreditNoteDao.SaveOrUpdateHQLByQuery(hql, parameter);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#findNameQuery(java.lang.String, java.util.HashMap)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<CustomerCreditNote> findNameQuery(String queryName, HashMap<String, String> parameter) throws HibernateException, Exception {

		return customerCreditNoteDao.findNameQuery(queryName, parameter);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#SaveOrUpdateQueryName(java.lang.String, java.util.HashMap)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void SaveOrUpdateQueryName(String queryName, HashMap<String, String> parameter) throws HibernateException, Exception {
		
		customerCreditNoteDao.SaveOrUpdateQueryName(queryName, parameter);
		
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#NextSequence(java.lang.String)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public BigDecimal NextSequence(String name) throws HibernateException, Exception {
		
		return customerCreditNoteDao.NextSequence(name);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#NextInstanceNo()
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public BigDecimal NextInstanceNo() throws HibernateException, Exception {

		return customerCreditNoteDao.NextInstanceNo();
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#UpdatedBack(com.tis.database.entitys.promis.GlPostingDetail)
	 * Date =Oct 15, 2013 : 1:28:23 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void UpdateBackSapMessage(GlPostingDetail glPostingDetail) throws HibernateException, Exception {
		customerCreditNoteDao.UpdatedBack(glPostingDetail);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#getCurrentDatabaseDate()
	 * Date =Oct 17, 2013 : 5:56:00 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public Date getCurrentDatabaseDate() throws HibernateException, Exception {

		return customerCreditNoteDao.getCurrentDatabaseDate();
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.ICustomerCreditNoteServices#FindByIs(java.lang.String, java.lang.String, java.lang.String, int)
	 * Date =Oct 30, 2013 : 11:27:15 AM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<CustomerCreditNote> FindByIs(String status, String syncIsstaging, String syncIssync, int maxResult) throws Exception {
		// TODO Auto-generated method stub
		return customerCreditNoteDao.FindByIs(status, syncIsstaging, syncIssync, maxResult);
	}

}
